﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using Server.Model;

namespace Server.Menus
{
    public partial class RegisteredClients : Form
    {
        private readonly ServerData _servData;

        public RegisteredClients( ServerData servData )
        {
            _servData = servData;
            InitializeComponent( );
        }

        private void RegisteredClients_Activated( object sender, EventArgs e )
        {
            listBox1.Items.Clear( );
            foreach( KeyValuePair<String, User> item in _servData.UsersList )
            {
                StringBuilder sb = new StringBuilder( );
                sb.Append( String.Format( "{0}->{1} {2}", item.Key, item.Value.UserName, item.Value.Location ) );
                listBox1.Items.Add( sb.ToString( ) );
            }
        }

        private void button1_Click( object sender, EventArgs e )
        {
            Hide( );
        }
    }
}